package com.example.controller;

import com.example.domain.TeacherEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping("/test")
public class UserController {

    @RequestMapping("/index")
    public ModelAndView index(){
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("index");
        return  modelAndView;
    }

    @RequestMapping("/index1")
    public  String index1(){
        return "index";
    }

    @ResponseBody
    @RequestMapping("testJSON")
    public TeacherEntity testJSON(){
        TeacherEntity teacherEntity = new TeacherEntity();
        teacherEntity.setTid(100);
        teacherEntity.setTeachername("testJson");
        return teacherEntity;
    }
}
